import request from '@/utils/request'
import { Igoods } from '@/api/typing'


export async function queryProse(): Promise<any> {
  return request('/project/prose')
}

export async function queryBanner(): Promise<any> {
  return request.get('/banner')
}


export async function queryTypeProducts(): Promise<any> {
  return request.get('/typeProducts')
}

export const goodList = async (list: Igoods) => {
  return request.get('/typeProducts', { params: list })
}


export const queryBanner2 = async () => {
  return request.get('/banner')
}


//获取菜单类型数据
export const queryType = () => {
  return request.get('/type')
}

//登录
export const login = (data: object) => {
  return request.post('/login', { ...data })
}

//获取用户信息
export const getUser = () => {
  return request.get('/findMy')
}

//获取购物袋商品信息
export const getShopbagProduct = () => {
  return request.get('/findAllShopcart')
}



//获取商品详情
export const getproductDetail = (data: string) => {
  return request.get('/productDetail?pid=' + data)
}

//获取购物车数量
export const getshopcartCount = () => {
  return request.get('/shopcartCount')
}

//获取收藏商品
export const getfindlike = (data: object) => {
  return request.get('/findlike', { params: data })
}


//取消收藏商品
export const postnotlike = (data: object) => {
  return request.post('/notlike', { ...data })
}

//收藏商品
export const postlike = (data: object) => {
  return request.post('/like', { ...data })
}


//添加购物车商品
export const postAddShop = (data: object) => {
  return request.post('/addShopcart', { ...data })
}



//获取提交的订单
export const getCommitsh = (data: object) => {
  return request.get('/commitShopcart', { params: data })
}


//获取用户地址
export const getfindAddress = () => {
  return request.get('/findAddress')
}


//支付订单
export const postPay = (data: object) => {
  return request.post('/pay', { ...data })
}

//获取用户订单数据
export const getfindOrder = (data: object) => {
  return request.get('/findOrder', { params: data })
}



//确认订单
export const postreceive = (data: object) => {
  return request.post('/receive', { ...data })
}

// removeOrder

//删除订单
export const postremoveOrder = (data: object) => {
  return request.post('/removeOrder', { ...data })
}

//修改商品数量
export const postmodifyShopcartCount = (data: object) => {
  return request.post('/modifyShopcartCount', { ...data })
}

//删除商品
export const postdeleteShopcart = (data: object) => {
  return request.post('/deleteShopcart', { ...data })
}


//获取用户信息
export const getfindAccountInfo = () => {
  return request.get('/findAccountInfo')
}

//获取用户收藏信息
export const getfindAllLike = () => {
  return request.get('/findAllLike')
}


//编辑地址信息
export const posteditAddress = (data: object) => {
  return request.post('/editAddress', { ...data })
}

//新增地址信息
export const postaddAddress = (data: object) => {
  return request.post('/addAddress', { ...data })
}


//获取具体地址信息
export const getfindAddressByAid = (data: object) => {
  return request.get('/findAddressByAid', { params: data })
}


//删除地址信息
export const postdeleteAddress = (data: object) => {
  return request.post('/deleteAddress', { ...data })
}
// deleteAddress

//搜索菜品
export const getsearch = (data: object) => {
  return request.get('/search', { params: data })
}


export const postUpdateAvatar = (data: object) => {
  return request.post('/updateAvatar', { ...data })
}